/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.jesseenglish.swingftfy.additions;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

/**
 *
 * @author english1
 */
public class DetailJPanel extends JPanel {

    protected Color borderColor = Color.WHITE;
    protected Color fillColor = new Color(0, 0, 0, 220);

    public DetailJPanel() {
        this.setOpaque(false);
        this.setBorder(new EmptyBorder(55, 55, 55, 55));
    }

    @Override
    protected void paintComponent(Graphics g) {
        int x = 34;
        int y = 34;
        int w = getWidth() - 68;
        int h = getHeight() - 68;
        int arc = 30;

        Graphics2D g2 = (Graphics2D) g.create();
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);

        g2.setColor(fillColor);
        g2.fillRoundRect(x, y, w, h, arc, arc);

        g2.setStroke(new BasicStroke(3f));
        g2.setColor(borderColor);
        g2.drawRoundRect(x, y, w, h, arc, arc);

        g2.dispose();
    }

    public void setBorderColor(Color borderColor) {
        this.borderColor = borderColor;
    }

    public void setFillColor(Color fillColor) {
        this.fillColor = fillColor;
    }

}
